home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 242 / Issue 242 - April 2008 - DPCS0408DVD.ISO / Software Money Savers / VirtualDub / Source / VirtualDub-1.7.7-src.7z / src / h / vd2 / system / memory.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-08-03  |  3.0 KB  |  73 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    System library component
  3. //    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. //
  5. //    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. //    differently than the remainder of VirtualDub.  This particular file is
  7. //    thus licensed as follows (the "zlib" license):
  8. //
  9. //    This software is provided 'as-is', without any express or implied
  10. //    warranty.  In no event will the authors be held liable for any
  11. //    damages arising from the use of this software.
  12. //
  13. //    Permission is granted to anyone to use this software for any purpose,
  14. //    including commercial applications, and to alter it and redistribute it
  15. //    freely, subject to the following restrictions:
  16. //
  17. //    1.    The origin of this software must not be misrepresented; you must
  18. //        not claim that you wrote the original software. If you use this
  19. //        software in a product, an acknowledgment in the product
  20. //        documentation would be appreciated but is not required.
  21. //    2.    Altered source versions must be plainly marked as such, and must
  22. //        not be misrepresented as being the original software.
  23. //    3.    This notice may not be removed or altered from any source
  24. //        distribution.
  25.  
  26. #ifndef f_VD2_SYSTEM_MEMORY_H
  27. #define f_VD2_SYSTEM_MEMORY_H
  28.  
  29. #include <vd2/system/vdtypes.h>
  30.  
  31. void *VDAlignedMalloc(size_t n, unsigned alignment);
  32. void VDAlignedFree(void *p);
  33.  
  34. template<unsigned alignment>
  35. struct VDAlignedObject {
  36.     inline void *operator new(size_t n) { return VDAlignedMalloc(n, alignment); }
  37.     inline void operator delete(void *p) { VDAlignedFree(p); }
  38. };
  39.  
  40. void VDSwapMemory(void *p0, void *p1, unsigned bytes);
  41. void VDInvertMemory(void *p, unsigned bytes);
  42.  
  43. bool VDIsValidReadRegion(const void *p, size_t bytes);
  44. bool VDIsValidWriteRegion(void *p, size_t bytes);
  45.  
  46. bool VDCompareRect(void *dst, ptrdiff_t dstpitch, const void *src, ptrdiff_t srcpitch, size_t w, size_t h);
  47.  
  48. void VDMemset8(void *dst, uint8 value, size_t count);
  49. void VDMemset16(void *dst, uint16 value, size_t count);
  50. void VDMemset32(void *dst, uint32 value, size_t count);
  51. void VDMemset64(void *dst, uint64 value, size_t count);
  52. void VDMemset128(void *dst, const void *value, size_t count);
  53. void VDMemsetPointer(void *dst, const void *value, size_t count);
  54.  
  55. void VDMemset8Rect(void *dst, ptrdiff_t pitch, uint8 value, size_t w, size_t h);
  56. void VDMemset16Rect(void *dst, ptrdiff_t pitch, uint16 value, size_t w, size_t h);
  57. void VDMemset32Rect(void *dst, ptrdiff_t pitch, uint32 value, size_t w, size_t h);
  58.  
  59. #if defined(_WIN32) && defined(_M_IX86)
  60.     extern void (__cdecl *VDFastMemcpyPartial)(void *dst, const void *src, size_t bytes);
  61.     extern void (__cdecl *VDFastMemcpyFinish)();
  62.     void VDFastMemcpyAutodetect();
  63. #else
  64.     void VDFastMemcpyPartial(void *dst, const void *src, size_t bytes);
  65.     void VDFastMemcpyFinish();
  66.     void VDFastMemcpyAutodetect();
  67. #endif
  68.  
  69.  
  70. void VDMemcpyRect(void *dst, ptrdiff_t dststride, const void *src, ptrdiff_t srcstride, size_t w, size_t h);
  71.  
  72. #endif
  73.